<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "dm_nhom_hang".
 *
 * @property integer $id
 * @property string $ma
 * @property string $ten
 * @property string $chu_thich
 *
 * @property DmHangHoa[] $dmHangHoas
 */
class DmNhomHang extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'dm_nhom_hang';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ma', 'ten', 'chu_thich'], 'required'],
            [['ma'], 'string', 'max' => 5],
            [['ten'], 'string', 'max' => 150],
            [['chu_thich'], 'string', 'max' => 300]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'ma' => 'Ma',
            'ten' => 'Ten',
            'chu_thich' => 'Chu Thich',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getDmHangHoas()
    {
        return $this->hasMany(DmHangHoa::className(), ['nhom_id' => 'id']);
    }
}
